package com.example.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * @Date 2022/3/5
 * @Created by Jonathan
 */
@Configuration
public class AppConfig {


    /*

    注解的形式配置InternalResourceViewResolver
    注意：1.DispatcherServlet封装的Spring工厂只能读取XML，所以无法进行纯注解替代
         2.这个配置文件需要放到扫描路径下面

    */
    @Bean
    public InternalResourceViewResolver viewResolver() {
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setPrefix("/");
        viewResolver.setSuffix(".jsp");
        return viewResolver;
    }

}
